feat: add musl target support in npm pakcage #1067
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In this PR i am adding support for the linux musl target in the npm package
@biomejs/biome
.The idea of adding this feature was initially introduced in discussion #946, since from version 1.40 biome is now built also for the linux musl target thanks to PR #821.
In this PR i am modifying the following files:
generate-packages.mjs
: to add the generation of the packages also for linux-musl and add libc field to package.json (reference issue: Support libc field in package.json pnpm/pnpm#4454)postinstall.js
: to identify if on linux-musl and select the correct packageisMusl
function was implemented as suggested in Add `musl` detection in `postinstall.js` #946 following the implementation of detect if we are installing musl or gnu target microsoft/vscode-ripgrep#25, with the only difference that I used the sync version of exec.biome/bin/biome
: add linux-musl detectionMinore issue, though I do not know if it is solvable, on linux with npm it will install both
@biomejs/cli-linux-${arch}
and@biomejs/cli-linux-${arch}-musl
, since npm will install based on arch and platform (which islinux
for both packages).Test Plan
I tested the
isMusl()
function on both linux and alpine to check it was working properly.I checked that
getName()
was returning the correct names for the various platforms and arch.I tested locally, by running
npm pack
and installing them locally and on alpine, the correct musl target is run.Tested also with
bun
on alpine, and withpnpm
.